//
//  KAChangeMobileResultVC.swift
//  kano
//
//  Created by Frank on 2024/11/1.
//

import UIKit

class KAChangeMobileResultVC: KABaseVC {
    
    lazy var var_resultImg: UIImageView = {
        let var_resultImg = UIImageView(image: UIImage(named: "apply_success"))
        return var_resultImg
    }()
    
    public var symbolLabel: UILabel = {
        let label = UILabel()
        label.numberOfLines = 0
        label.font = UIFont.systemFont(ofSize: kscale(16), weight: .bold)
        label.textColor = .black
        label.text = "Phone Number Changed Successfully. Please log in again with the new phone number."
        return label
    }()
    
    lazy var var_homeBtn: UIButton = {
        let var_homeBtn = UIButton()
        var_homeBtn.setTitle("Log In Now", for: .normal)
        var_homeBtn.setTitleColor(.white, for: .normal)
        var_homeBtn.titleLabel?.font = UIFont.systemFont(ofSize: kscale(17), weight: .bold)
        var_homeBtn.backgroundColor = .themeColor
        var_homeBtn.layer.cornerRadius = kscale(25)
        var_homeBtn.layer.masksToBounds = true
        var_homeBtn.addTarget(self, action: #selector(ka_var_homeBtnClick), for: .touchUpInside)
        return var_homeBtn
    }()
    @objc func ka_var_homeBtnClick() {
        KAUserManager.shared.userLogout()
    }
    
    override func customNavBackAction() {
        navigationController?.popToRootViewController(animated: true)
    }
    
    var result: KAApplyResult = .reviewing
    
    
    init() {
        super.init(nibName: nil, bundle: nil)
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

extension KAChangeMobileResultVC {
    override func viewDidLoad() {
        super.viewDidLoad()
        ka_setUI()
    }

    func ka_setUI() {
        
        view.backgroundColor = .colorf2f2f5
        view.addSubview(var_resultImg)
        view.addSubview(var_homeBtn)
        view.addSubview(symbolLabel)
        
        ka_showCustomerNavBar(type: .center)
        var_navBar.var_backBtn.isHidden = true
        var_navBar.var_titleLabel.text = "Result"
        
        var_resultImg.snp.makeConstraints { make in
            make.size.equalTo(CGSize(width: kscale(120), height: kscale(120)))
            make.top.equalTo(UIDevice.ka_fullNavHeight+kscale(32))
            make.centerX.equalTo(view)
        }
        symbolLabel.snp.makeConstraints { make in
            make.left.equalTo(view).offset(kscale(20))
            make.right.equalTo(view).offset(kscale(-20))
            make.top.equalTo(var_resultImg.snp.bottom).offset(kscale(18))
        }
        var_homeBtn.snp.makeConstraints { make in
            make.left.equalTo(view).offset(kscale(20))
            make.right.equalTo(view).offset(kscale(-20))
            make.top.equalTo(symbolLabel.snp.bottom).offset(kscale(40))
            make.height.equalTo(kscale(50))
        }
    }
}
